/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.storage.entity;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 验证码Entity
 */
@Table(name="biz_sms", alias="a", columns={
		@Column(name="id", attrName="id", label="唯一标识", isPK=true),
		@Column(name="phone", attrName="phone", label="手机号"),
		@Column(name="code", attrName="code", label="验证码"),
		@Column(name="type",attrName = "type",label = "验证码类型"),
		@Column(name="minute", attrName="minute", label="分钟"),
		@Column(name="expire_time",attrName = "expireTime",label = "过期时间"),
		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false, isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false),
	}, orderBy="a.update_date DESC"
)
public class Sms extends DataEntity<Sms> {
	
	private static final long serialVersionUID = 1L;
	private String phone;		// 手机号
	private String code;		// 验证码
	private String type;        //验证码类型
	private Integer minute;		// 分钟
	private Date expireTime;    //过期时间

	
	public Sms() {
		this(null);
	}

	public Sms(String id){
		super(id);
	}
	
	@NotBlank(message="手机号不能为空")
	@Length(min=0, max=16, message="手机号长度不能超过 16 个字符")
	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	@NotBlank(message="验证码不能为空")
	@Length(min=0, max=6, message="验证码长度不能超过 6 个字符")
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
	
	@NotNull(message="分钟不能为空")
	public Integer getMinute() {
		return minute;
	}

	public void setMinute(Integer minute) {
		this.minute = minute;
	}

	public Date getExpireTime() {
		return expireTime;
	}

	public void setExpireTime(Date expireTime) {
		this.expireTime = expireTime;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}
}
